<%@page import="database.*"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="/Project1/layui-v2.6.13/layui/layui.js"></script>
<script type="text/javascript" src="/Project1/js/jquery-1.9.1.min.js"></script>
<meta charset="utf-8">
<title>专业更新页</title>
</head>
<%
List<Major> list = DP.update(Major.class, "select * from major", null);
request.setAttribute("list", list);
List<College> list2 = DP.update(College.class, "select * from college", null);
request.setAttribute("list2", list2);
request.setAttribute("id", request.getParameter("id"));
request.setAttribute("cid", request.getParameter("cid"));

%>
<body>
	<form>
	<input type="hidden" name="id"
	<c:forEach items="${list}" var="li">
	<c:if test="${li.id eq id}">value="${li.id }"</c:if>
	</c:forEach>
	>
	<select name="cid">
		<c:forEach items="${list2 }" var="li2">
		<option value="${li2.id }" <c:if test="${li2.id eq cid}">selected</c:if>>${li2.name }</option>
		</c:forEach>
	</select>
	<button onclick="up2()">更新</button>	
	</form>
</body>
<script>
	layui.use('layer',function(){
		var layer = layui.layer;
	});
	function up2(){
		var form = $("form").serialize();
		$.ajax({
			url:'<%=request.getContextPath()%>/m',
			type:'post',
			data:'method=update&'+form,
			success:function(obj){
				var index = parent.layer.getFrameIndex(window.name);
				parent.layer.close(index);
			}
		});
	}
</script>
</html>

















